package unit3;


public class Ex3_1_Box {
    public static void main(String args[]) {
        Box mybox1 = new Box();
        Box mybox2 = new Box();
        double vol1,vol2;
        mybox1.setlwh(10,20,15);
        vol1= mybox1.volume( );
        mybox2.setlwh(12.8,89,153);
        vol2= mybox2.volume( );
        System.out.println("mybox1的体积是：" + vol1);
        System.out.println("mybox2的体积是：" + vol2);
    }
}
class Box {
    // 成员变量，实例变量，属性
    double lenth;
    double width;
    double height;

    // 成员方法，实例方法
    void  setlwh (double l ,double w, double h ) {
        lenth=l;
        width=w;
        height=h;
    }
    double  volume( ) {
        return   lenth* width* height;
    }
}

